package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
public class AdChannelController {

    @Autowired
    private IWemediaClient iWemediaClient;

    /**
     *频道查询
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult findList(@RequestBody ChannelDto dto){
        return iWemediaClient.findList(dto);
    }

    /**
     * 新增频道
     * @param wmChannel
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveChannel(@RequestBody WmChannel wmChannel){
        return iWemediaClient.saveChannel(wmChannel);
    }
    /**
     * 修改频道
     */
    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody WmChannel wmChannel){
        return iWemediaClient.updateChannel(wmChannel);
    }
    @GetMapping("/del/{id}")
    public ResponseResult deleteChannelById(@PathVariable("id") Integer id){
        return iWemediaClient.deleteChannelById(id);
    }
}
